package com.android.test.net.api;

import com.google.gson.Gson;

public class GsonUtil {
	
	private static Gson g;
	
	public static void initGson(){
		g = new Gson();
	}
	
	public static <T> Object FromJson(String json,Class<T> cl){
		Object obj = null;
		if(null==g){
			initGson();
		}
		obj = g.fromJson(json,cl);
		return obj;
	}
	
	public static String ToJson(Object obj){
		String json = "";
		if(null==g){
			initGson();
		}
		json = g.toJson(obj);
		return json;
	}
}
